local jiaojin = fk.CreateSkill {

  name = "joy__jiaojin",

  tags = {  },

}



jiaojin:addEffect(fk.TargetConfirmed, {
  name = "joy__jiaojin",
  anim_type = "defensive",
  events = {fk.TargetConfirmed},
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(jiaojin.name) and data.from ~= player.id and (data.card.trueName == "slash" or data.card:isCommonTrick()) and not player:isKongcheng()
  end,
  on_cost = function(self, event, target, player, data)
    local cards = player.room:askForDiscard(player, 1, 1, false, jiaojin.name, true, ".", "#joy__jiaojin-discard::"..data.from..":"..data.card:toLogString(), true)
    if #cards > 0 then
      event:setCostData(self, cards)
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    room:throwCard(event:getCostData(self), jiaojin.name, player)
    table.insertIfNeed(data.nullifiedTargets, player.id)
  end,
})

return jiaojin